home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / MPW IIGS Interfaces / CIIGSIncludes / Control.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-01  |  15.5 KB  |  435 lines  |  [TEXT/MPS ]

  1. /********************************************
  2. ; File: Control.h
  3. ;
  4. ;
  5. ; Copyright Apple Computer, Inc.1986-90
  6. ; All Rights Reserved
  7. ;
  8. ********************************************/
  9.  
  10. #ifndef __TYPES__
  11. #include <TYPES.h>
  12. #endif
  13.  
  14. #ifndef __QUICKDRAW__
  15. #include <QUICKDRAW.h>
  16. #endif
  17.  
  18. #ifndef __EVENT__
  19. #include <EVENT.h>
  20. #endif
  21.  
  22. #ifndef __CONTROL__
  23. #define __CONTROL__
  24.  
  25.  
  26. /* Axis Parameters */
  27. #define noConstraint 0x0000  /* No constraint on movement. */
  28. #define hAxisOnly 0x0001  /* Horizontal axis only. */
  29. #define vAxisOnly 0x0002  /* Vertical axis only. */
  30.  
  31. /* CtlFlag */
  32. #define simpRound 0x0000  /* Simple button flag */
  33. #define upFlag 0x0001  /* Scroll bar flag.  */
  34. #define boldButton 0x0001  /* Bold round cornered outlined button. */
  35. #define simpBRound 0x0001  /* Simple button flag */
  36. #define downFlag 0x0002  /* Scroll bar flag. */
  37. #define simpSquare 0x0002  /* Simple button flag */
  38. #define simpDropSquare 0x0003  /* Simple button flag */
  39. #define leftFlag 0x0004  /* Scroll bar flag. */
  40. #define rightFlag 0x0008  /* Scroll bar flag. */
  41. #define dirScroll 0x0010  /* Scroll bar flag. */
  42. #define horScroll 0x0010  /* Scroll bar flag. */
  43. #define family 0x007F  /* Mask for radio button family number */
  44. #define ctlInVis 0x0080  /* invisible mask for any type of control  */
  45. #define fCallWindowMgr 0x0001  /* Control Template flag value */
  46. #define fSubstituteText 0x0002
  47. #define fSubTextType 0x0001
  48. #define inListBox 0x88
  49.  
  50. /* CtlProc Codes */
  51. #define simpleProc 0x00000000L
  52. #define checkProc 0x02000000L
  53. #define radioProc 0x04000000L
  54. #define scrollProc 0x06000000L
  55. #define growProc 0x08000000L
  56.  
  57. /* DefProc Commands */
  58. #define drawCtl 0x0000  /* Draw control command. */
  59. #define calcCRect 0x0001  /* Compute drag RECT command. */
  60. #define testCtl 0x0002  /* Hit test command. */
  61. #define initCtl 0x0003  /* Initialize command. */
  62. #define dispCtl 0x0004  /* Dispose command. */
  63. #define posCtl 0x0005  /* Move indicator command. */
  64. #define thumbCtl 0x0006  /* Compute drag parameters command. */
  65. #define dragCtl 0x0007  /* Drag command. */
  66. #define autoTrack 0x0008  /* Action command. */
  67. #define newValue 0x0009  /* Set new value command. */
  68. #define setParams 0x000A  /* Set new parameters command. */
  69. #define moveCtl 0x000B  /* Move command. */
  70. #define recSize 0x000C  /* Return record size command. */
  71. #define ctlHandleEvent 0x000D  /* Handle a keystroke or menu selection */
  72. #define ctlChangeTarget 0x000E  /* Issued when control's target status has changed */
  73. #define ctlChangeBounds 0x000F  /* Issued when control's boundary rectangle has changed */
  74. #define ctlWindChangeSize 0x0010  /* Window has been grown or zoomed */
  75. #define ctlHandleTab 0x0011  /* Control has been tabbed to */
  76. #define ctlNotifyMultiPart 0x0012  /* A multipart control has been hidden, drawn or shown */
  77. #define ctlWinStateChange 0x0013  /* Window state has changed */
  78.  
  79. /* hiliteState Codes */
  80. #define noHilite 0x0000  /* Param to HiliteControl */
  81. #define inactiveHilite 0x00FF  /* Param to HiliteControl */
  82.  
  83. /* PartCode Numbers */
  84. #define noPart 0x0000
  85. #define simpleButton 0x0002
  86. #define checkBox 0x0003
  87. #define radioButton 0x0004
  88. #define upArrow 0x0005
  89. #define downArrow 0x0006
  90. #define pageUp 0x0007
  91. #define pageDown 0x0008
  92. #define growBox 0x000A
  93. #define thumb 0x0081
  94.  
  95. /* moreFlags Codes */
  96. #define fCtlTarget 0x8000  /* is current target of typing commands */
  97. #define fCtlCanBeTarget 0x4000  /* can be made the target control */
  98. #define fCtlWantEvent 0x2000  /* control can be called view SendEventToCtl */
  99. #define fCtlWantsEvent 0x2000  /* control can be called view SendEventToCtl */
  100. #define fCtlWantEvents 0x2000  /* control can be called view SendEventToCtl */
  101. #define fCtlWantsEvents 0x2000  /* control can be called view SendEventToCtl */
  102. #define fCtlProcRefNotPtr 0x1000  /* set = ID of defproc, clear = pointer to defproc */
  103. #define fCtlTellAboutSize 0x0800  /* set if ctl needs notification when size of owning window changes */
  104. #define fCtlIsMultiPart 0x0400  /* set if ctl needs notification to be hidden */
  105. #define fMenuDefIsText 0x0004
  106. #define colorDescriptor 0x000C  /* indicates type of reference in colorRef */
  107. #define styleDescriptor 0x0003  /* indicates type of reference in styleRef */
  108.  
  109. /* Ctl Verbs */
  110. #define titleIsPtr 0x00
  111. #define titleIsHandle 0x01
  112. #define titleIsResource 0x02
  113. #define colorTableIsPtr 0x00
  114. #define colorTableIsHandle 0x04
  115. #define colorTableIsResource 0x08
  116. #define ctlHideCtl 0x12
  117.  
  118. /* InputVerb Codes */
  119. #define singlePtr 0x0000
  120. #define singleHandle 0x0001
  121. #define singleResource 0x0002
  122. #define ptrToPtr 0x0003
  123. #define ptrToHandle 0x0004
  124. #define ptrToResource 0x0005
  125. #define handleToPtr 0x0006
  126. #define handleToHandle 0x0007
  127. #define handleToResource 0x0008
  128. #define resourceToResource 0x0009
  129.  
  130. /* ProcRefs */
  131. #define simpleButtonControl 0x80000000L
  132. #define checkControl 0x82000000L
  133. #define radioControl 0x84000000L
  134. #define scrollBarControl 0x86000000L
  135. #define growControl 0x88000000L
  136. #define statTextControl 0x81000000L
  137. #define editLineControl 0x83000000L
  138. #define editTextControl 0x85000000L
  139. #define popUpControl 0x87000000L
  140. #define listControl 0x89000000L
  141. #define iconButtonControl 0x07FF0001L
  142. #define pictureControl 0x8D000000L
  143.  
  144. /* Error Codes */
  145. #define wmNotStartedUp 0x1001  /* Window manager was not initialized */
  146. #define cmNotInitialized 0x1002  /* Control manager was not initialized */
  147. #define noCtlInList 0x1003  /* Control not in window list */
  148. #define noCtlError 0x1004  /* no controls in window */
  149. #define noSuperCtlError 0x1005  /* no super controls in window */
  150. #define noCtlTargetError 0x1006  /* no target super control */
  151. #define notSuperCtlError 0x1007  /* action can only be done on super control */
  152. #define canNotBeTargetError 0x1008  /* conrol cannot be made target */
  153. #define noSuchIDError 0x1009  /* specified ID cannot be found */
  154. #define tooFewParmsError 0x100A  /* not enough params specified */
  155. #define noCtlToBeTargetError 0x100B  /* NextCtl call, no ctl could be target */
  156. #define noFrontWindowError 0x100C  /* there is no front window */
  157.  
  158. /* displayMode flags */
  159. #define selectedIcon 0x0001
  160. #define openIcon 0x0002
  161. #define offline 0x0004
  162.  
  163. /* listType values */
  164. #define fListString 0x0001
  165. #define fListSelect 0x0002
  166. #define fListScrollBar 0x0004
  167.  
  168. /* PopUp control flag values */
  169. #define fRightJustifyResult 0x0001
  170. #define fRightJustifyTitle 0x0002
  171. #define fInWindowOnly 0x0004
  172. #define fDontDrawResult 0x0008
  173. #define fDontDrawTitle 0x0010
  174. #define fDontHiliteTitle 0x0020
  175. #define fType2PopUp 0x0040
  176. #ifndef WindowPtr
  177. typedef GrafPortPtr WindowPtr;
  178. #endif
  179.  
  180. struct BarColors {
  181.    Word barOutline; /* color for outlining bar, arrows, and thumb */
  182.    Word barNorArrow; /* color of arrows when not highlighted */
  183.    Word barSelArrow; /* color of arrows when highlighted */
  184.    Word barArrowBack; /* color of arrow box's background */
  185.    Word barNorThumb; /* color of thumb's background when not highlighted */
  186.    Word barSelThumb; /* color of thumb's background when highlighted */
  187.    Word barPageRgn; /* color and pattern page region: high byte - 1= dither, 0 = solid */
  188.    Word barInactive; /* color of scroll bar's interior when inactive */
  189. } ;
  190. typedef struct BarColors BarColors, *BarColorsPtr, **BarColorsHndl;
  191.  
  192. struct BoxColors {
  193.    Word boxReserved; /* reserved */
  194.    Word boxNor; /* color of box when not checked */
  195.    Word boxSel; /* color of box when checked */
  196.    Word boxTitle; /* color of check box's title */
  197. } ;
  198. typedef struct BoxColors BoxColors, *BoxColorsPtr, **BoxColorsHndl;
  199.  
  200. struct BttnColors {
  201.    Word bttnOutline; /* color of outline */
  202.    Word bttnNorBack; /* color of background when not selected */
  203.    Word bttnSelBack; /* color of background when selected */
  204.    Word bttnNorText; /* color of title's text when not selected */
  205.    Word bttnSelText; /* color of title's text when selected */
  206. } ;
  207. typedef struct BttnColors BttnColors, *BttnColorsPtr, **BttnColorsHndl;
  208.  
  209. struct CtlRec {
  210.    struct CtlRec **ctlNext; /* Handle of next control. */
  211.    WindowPtr ctlOwner; /* Pointer to control's window. */
  212.    Rect ctlRect; /* Enclosing rectangle. */
  213.    Byte ctlFlag; /* Bit flags. */
  214.    Byte ctlHilite; /* Highlighted part. */
  215.    Word ctlValue; /* Control's value. */
  216.    LongProcPtr ctlProc; /* Control's definition procedure. */
  217.    LongProcPtr ctlAction; /* Control's action procedure. */
  218.    Longint ctlData; /* Reserved for CtrlProc's use. */
  219.    Longint ctlRefCon; /* Reserved for application's use. */
  220.    Pointer ctlColor; /* Pointer to appropriate color table. */
  221.    Byte ctlReserved[16]; /* Reserved for future expansion */
  222.    LongWord ctlID; /*  */
  223.    Word ctlMoreFlags; /*  */
  224.    Word ctlVersion; /*  */
  225. } ;
  226. typedef struct CtlRec CtlRec, *CtlRecPtr, **CtlRecHndl, ***CtlRecHndlPtr;
  227.  
  228. struct LimitBlk {
  229.    Rect boundRect; /* Drag bounds. */
  230.    Rect slopRect; /* Cursor bounds. */
  231.    Word axisParam; /* Movement constrains. */
  232.    Pointer dragPatt; /* Pointer to 32 byte Pattern for drag outline. */
  233. } ;
  234. typedef struct LimitBlk LimitBlk, *LimitBlkPtr, **LimitBlkHndl;
  235.  
  236. struct RadioColors {
  237.    Word radReserved; /* reserved */
  238.    Word radNor; /* color of radio button when off */
  239.    Word radSel; /* color of radio button when on */
  240.    Word radTitle; /* color of radio button's title text */
  241. } ;
  242. typedef struct RadioColors RadioColors, *RadioColorsPtr, **RadioColorsHndl;
  243.  
  244. struct KeystrokeRec {
  245.    Byte key1; /*   */
  246.    Byte key2; /*   */
  247.    Word keyModifiers; /*   */
  248.    Word keyCareBits; /*   */
  249. } ;
  250. typedef struct KeystrokeRec KeystrokeRec;
  251.  
  252. struct ControlTemplate {
  253.    Word pCount; /*   */
  254.    LongWord ID; /*   */
  255.    Rect rect; /*   */
  256.    LongWord procRef; /*   */
  257.    Word flag; /*   */
  258.    Word moreFlags; /*   */
  259.    LongWord refCon; /*   */
  260. } ;
  261. typedef struct ControlTemplate ControlTemplate;
  262.  
  263. struct SimpleButtonTemplate {
  264.    ControlTemplate ctlTemplate; /*   */
  265.    Ref titleRef; /*   */
  266.    Ref colorTableRef; /*   */
  267.    KeystrokeRec keyEquivalent; /*   */
  268. } ;
  269. typedef struct SimpleButtonTemplate SimpleButtonTemplate;
  270.  
  271. struct CheckBoxTemplate {
  272.    ControlTemplate ctlTemplate; /*   */
  273.    Ref titleRef; /*   */
  274.    Word initalValue; /*   */
  275.    Ref colorTableRef; /*   */
  276.    KeystrokeRec keyEquivalent; /*   */
  277. } ;
  278. typedef struct CheckBoxTemplate CheckBoxTemplate;
  279.  
  280. struct IconButtonTemplate {
  281.    ControlTemplate ctlTemplate; /*   */
  282.    Ref iconRef; /*   */
  283.    Ref titleRef; /*   */
  284.    Ref colorTableRef; /*   */
  285.    Word displayMode; /*   */
  286.    KeystrokeRec keyEquivalent; /*   */
  287. } ;
  288. typedef struct IconButtonTemplate IconButtonTemplate;
  289.  
  290. struct LineEditTemplate {
  291.    ControlTemplate ctlTemplate; /*   */
  292.    Word maxSize; /*   */
  293.    Ref defaultRef; /*   */
  294. } ;
  295. typedef struct LineEditTemplate LineEditTemplate;
  296.  
  297. struct ListTemplate {
  298.    ControlTemplate ctlTemplate;
  299.    Word listSize;
  300.    Word listView;
  301.    Word listType;
  302.    Word listStart;
  303.    ProcPtr listDraw;
  304.    Word listMemHeight;
  305.    Word listMemSize;
  306.    Ref listRef;
  307.    Ref colorTableRef; /*   */
  308. } ;
  309. typedef struct ListTemplate ListTemplate;
  310.  
  311. struct PictureTemplate {
  312.    ControlTemplate ctlTemplate; /*   */
  313.    Ref pictureRef; /*   */
  314. } ;
  315. typedef struct PictureTemplate PictureTemplate;
  316.  
  317. struct PopupTemplate {
  318.    ControlTemplate ctlTemplate; /*   */
  319.    Word titleWidth; /*   */
  320.    Ref menuRef; /*   */
  321.    Word initialValue; /*   */
  322.    Ref colorTableRef; /*   */
  323. } ;
  324. typedef struct PopupTemplate PopupTemplate;
  325.  
  326. struct RadioButtonTemplate {
  327.    ControlTemplate ctlTemplate; /*   */
  328.    Ref titleRef; /*   */
  329.    Word initalValue; /*   */
  330.    Ref colorTableRef; /*   */
  331.    KeystrokeRec keyEquivalent; /*   */
  332. } ;
  333. typedef struct RadioButtonTemplate RadioButtonTemplate;
  334.  
  335. struct ScrollBarTemplate {
  336.    ControlTemplate ctlTemplate; /*   */
  337.    Word maxSize; /*   */
  338.    Word viewSize; /*   */
  339.    Word initalValue; /*   */
  340.    Ref colorTableRef; /*   */
  341. } ;
  342. typedef struct ScrollBarTemplate ScrollBarTemplate;
  343.  
  344. struct SizeBoxTemplate {
  345.    ControlTemplate ctlTemplate; /*   */
  346.    Ref colorTableRef; /*   */
  347. } ;
  348. typedef struct SizeBoxTemplate SizeBoxTemplate;
  349.  
  350. struct StaticTextTemplate {
  351.    ControlTemplate ctlTemplate; /*   */
  352.    Ref textRef; /*   */
  353.    Word textSize; /*   */
  354.    Word just; /*   */
  355. } ;
  356. typedef struct StaticTextTemplate StaticTextTemplate;
  357.  
  358. struct TextEditTemplate {
  359.    ControlTemplate ctlTemplate;
  360.    LongWord textFlags;
  361.    Rect indentRect;
  362.    CtlRecHndl vertBar;
  363.    Word vertAmount;
  364.    CtlRecHndl horzBar;
  365.    Word horzAmount;
  366.    Ref styleRef;
  367.    Word textDescriptor;
  368.    Ref textRef;
  369.    LongWord textLength;
  370.    LongWord maxChars;
  371.    LongWord maxLines;
  372.    Word maxCharsPerLine;
  373.    Word maxHeight;
  374.    Ref colorRef;
  375.    Word drawMode;
  376.    ProcPtr filterProcPtr;
  377. } ;
  378. typedef struct TextEditTemplate TextEditTemplate;
  379.  
  380. extern pascal LongWord CallCtlDefProc() inline(0x2C10,dispatcher);
  381. extern pascal Handle CMLoadResource() inline(0x3210,dispatcher);
  382. extern pascal void CMReleaseResource() inline(0x3310,dispatcher);
  383. extern pascal void CtlBootInit() inline(0x0110,dispatcher);
  384. extern pascal void CtlNewRes() inline(0x1210,dispatcher);
  385. extern pascal void CtlReset() inline(0x0510,dispatcher);
  386. extern pascal void CtlShutDown() inline(0x0310,dispatcher);
  387. extern pascal void CtlStartUp() inline(0x0210,dispatcher);
  388. extern pascal Boolean CtlStatus() inline(0x0610,dispatcher);
  389. extern pascal Word CtlVersion() inline(0x0410,dispatcher);
  390. extern pascal void DisposeControl() inline(0x0A10,dispatcher);
  391. extern pascal void DragControl() inline(0x1710,dispatcher);
  392. extern pascal Point DragRect() inline(0x1D10,dispatcher);
  393. extern pascal void DrawControls() inline(0x1010,dispatcher);
  394. extern pascal void DrawOneCtl() inline(0x2510,dispatcher);
  395. extern pascal void EraseControl() inline(0x2410,dispatcher);
  396. extern pascal Word FindControl () inline(0x1310,dispatcher);
  397. extern pascal CtlRecHndl FindTargetCtl() inline(0x2610,dispatcher);
  398. extern pascal void FutzCtls() inline(0x3610,dispatcher);
  399. extern pascal LongProcPtr GetCtlAction() inline(0x2110,dispatcher);
  400. extern pascal Word GetCtlDPage() inline(0x1F10,dispatcher);
  401. extern pascal CtlRecHndl GetCtlHandleFromID() inline(0x3010,dispatcher);
  402. extern pascal LongWord GetCtlID() inline(0x2A10,dispatcher);
  403. extern pascal Word GetCtlMoreFlags() inline(0x2E10,dispatcher);
  404. extern pascal Pointer GetCtlParamPtr() inline(0x3510,dispatcher);
  405. extern pascal LongWord GetCtlParams() inline(0x1C10,dispatcher);
  406. extern pascal LongWord GetCtlRefCon() inline(0x2310,dispatcher);
  407. extern pascal Pointer GetCtlTitle() inline(0x0D10,dispatcher);
  408. extern pascal Word GetCtlValue() inline(0x1A10,dispatcher);
  409. extern pascal LongWord GrowSize() inline(0x1E10,dispatcher);
  410. extern pascal void HideControl() inline(0x0E10,dispatcher);
  411. extern pascal void HiliteControl() inline(0x1110,dispatcher);
  412. extern pascal void InvalCtls() inline(0x3710,dispatcher);
  413. extern pascal void KillControls() inline(0x0B10,dispatcher);
  414. extern pascal CtlRecHndl MakeNextCtlTarget() inline(0x2710,dispatcher);
  415. extern pascal void MakeThisCtlTarget() inline(0x2810,dispatcher);
  416. extern pascal void MoveControl() inline(0x1610,dispatcher);
  417. extern pascal CtlRecHndl NewControl() inline(0x0910,dispatcher);
  418. extern pascal CtlRecHndl NewControl2() inline(0x3110,dispatcher);
  419. extern pascal void NotifyControls() inline(0x2D10,dispatcher);
  420. extern pascal void NotifyCtls() inline(0x2D10,dispatcher);
  421. extern pascal Boolean SendEventToCtl() inline(0x2910,dispatcher);
  422. extern pascal void SetCtlAction() inline(0x2010,dispatcher);
  423. extern pascal FontHndl SetCtlIcons() inline(0x1810,dispatcher);
  424. extern pascal void SetCtlID() inline(0x2B10,dispatcher);
  425. extern pascal void SetCtlMoreFlags() inline(0x2F10,dispatcher);
  426. extern pascal void SetCtlParamPtr() inline(0x3410,dispatcher);
  427. extern pascal void SetCtlParams() inline(0x1B10,dispatcher);
  428. extern pascal void SetCtlRefCon() inline(0x2210,dispatcher);
  429. extern pascal void SetCtlTitle() inline(0x0C10,dispatcher);
  430. extern pascal void SetCtlValue() inline(0x1910,dispatcher);
  431. extern pascal void ShowControl() inline(0x0F10,dispatcher);
  432. extern pascal Word TestControl() inline(0x1410,dispatcher);
  433. extern pascal Word TrackControl() inline(0x1510,dispatcher);
  434. #endif
  435.